home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: JamesCurran@CIS.CompuServe.Com (James M. Curran)
- Newsgroups: comp.lang.c
- Subject: Re: How do you pass along a variable argument list?
- Date: Sun, 14 Jan 1996 02:02:16 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4d9o7c$glb@dub-news-svc-6.compuserve.com>
- References: <4d1i8v$k8h@news.mcl.bdm.com> <4d30nv$k8r@tahko.lpr.carel.fi> <ALUN.CHAMPION.96Jan11093732@g7240065.bridge.bst.bls.com>
- NNTP-Posting-Host: dd01-001.compuserve.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- >>: ywu@plato.sky.bdm.com wrote:
- >>:> I am writing a wrapper around a routine which takes variable argument list only. I
- >>:> want my wrapper has the similar prototype and can pass the variable arguments
- >>:> directly to the routine(by the way, I cannot change the code of that routine).
- >>:> I guess it is really hard to do it in ANSI, and I know how to do it in a stupid
- >>:> way---but, is there any way around??
-
-
- Actually, I think most of the posters here are missing the point of the
- originally message. As I read it, he has a function defined as such:
-
- int other_func(int X,...);
-
- which *cannot* be changed, and he wants to write a function similar to:
-
- int my_func(int X,....)
- {
- /* work with X here */
- /* then --- */
- other_func(/* OK, so what exactly do we put here ?*/);
- }
-
-
- which as far as I can see means he's pretty much screwed. The only think
- I can think of have him try is:
-
- int my_func(int X,....)
-
-
- int my_func(int A, int B, int C, int D, int E, int F, int G /* etc */ .)
- {
- /* work with A here */
- /* then --- */
- other_func(A,B,C, D, E, F, G /*etc */);
- }
-
- adding enough variables to the list to cover every foreseeable case. The
- only thing I can say about this method, is that it'll probably work in most
- cases...
-
-
-
-